<template>
	<view>
		
		<!-- <view class=""> -->
		<!-- </view> -->
		<view class="remind">
			<span>锲而不舍，金石可镂</span>
			<button type="default" @tap="addFriend" size="mini">添加好友</button>
		</view>
		<view class="friendList">
			<!-- <h4>我的好友</h4> -->
			<view class="item" v-for="(v,o) in friendData" :key="o" v-if="friendData.length > 0">
			<view class="logoWarp">
				<image :src='v.logo' mode="widthFix" class="logo" v-if="!!v.logo"></image>
				<image src='https://www.longyugou.top:8008/small/logo.png' class="logo" v-else></image>
				<h4>{{v.user}}</h4>
			</view>
				<span>积分：{{v.integral}}</span>
			</view>
		</view>
	</view>
</template>

<script>
	import { selectFriend, selectAllUser } from "@/api/index.js"
	export default {
		data() {
			return {
				friendData: []
			}
		},
		onShow() {
			this.friendD()
		},
		methods: {
			addFriend(){
				uni.navigateTo({
					url: "/pages/addFriend/addFriend"
				})
			},
			async friendD(){
				let user = uni.getStorageSync("users")
				let res = await selectFriend({user});
				let ress = await selectAllUser();
				this.friendData = ress.data
				// if(!!res.data){
				// 	if(res.data.code === 1000){
				// 		this.friendData = res.data.data
				// 	} 
				// }
				// console.log(this.friendData,'this.friendData');
			}
		}
	}
</script>

<style scoped>
	page {
		background-color: aliceblue;
		padding: 20rpx;
	}
.item {
	padding: 20rpx;
	display: flex;
	justify-content: space-between;
	background-color: #fff;
	margin: 20rpx 0;
	border-radius: 10rpx;
}
.remind {
	padding: 20rpx;
	background-color: #2980B9;
	color: #fff;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.remind button{
	margin-right: 0;
}
.logoWarp {
	display: flex;
	align-items: center;
}
.logo {
	width: 50rpx;
	height: 50rpx;
	border-radius: 50%;
	margin-right: 20rpx;
}
</style>
